#include "State.h"

State::State(RenderWindow* window, PossibleState stateId) {
    this->window = window;
    
    this->stateId   = stateId;
    this->nextState = stateId;
    
    string filename;
    
    switch (stateId) {
        case MAIN_MENU:
            filename = "mainMenuGui.xml";
            break;
            
        case LEVEL_SELECT:
            filename = "levelSelectGui.xml";
            break;
            
        case LEVEL:
            filename = "levelGui.xml";
            break;
    }
    
    guiDoc = new TiXmlDocument(filename.c_str());
    guiDoc->LoadFile();
    guiXml = guiDoc->RootElement();
    
    // TODO: get from guidoc
    framerate = new String();
    framerate->SetPosition(25, 550);
    framerate->SetSize(20);
}

State::~State() {
    delete guiDoc;
    delete framerate;
}

string State::getFramerate() {
    return (string)Chameleon(1 / window->GetFrameTime());
}
       